<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 5.4.0">


  <link rel="apple-touch-icon" sizes="180x180" href="/hexo_blog/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/hexo_blog/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/hexo_blog/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/hexo_blog/images/logo.svg" color="#222">

<link rel="stylesheet" href="/hexo_blog/css/main.css">



<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.15.2/css/all.min.css">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/nprogress@0.2.0/nprogress.css">
  <script src="https://cdn.jsdelivr.net/npm/nprogress@0.2.0/nprogress.js"></script>

<script class="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"bone-nails.gitee.io","root":"/hexo_blog/","images":"/hexo_blog/images","scheme":"Gemini","version":"8.2.2","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12},"copycode":false,"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"motion":{"enable":false,"async":false,"transition":{"post_block":"fadeIn","post_header":"fadeInDown","post_body":"fadeInDown","coll_header":"fadeInLeft","sidebar":"fadeInUp"}},"prism":false,"i18n":{"placeholder":"搜索...","empty":"没有找到任何搜索结果：${query}","hits_time":"找到 ${hits} 个搜索结果（用时 ${time} 毫秒）","hits":"找到 ${hits} 个搜索结果"},"path":"/hexo_blog/search.xml","localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":true,"preload":true}};
  </script>
<meta name="description" content="Linux整理 linux多用户多任务多终端">
<meta property="og:type" content="article">
<meta property="og:title" content="Linux知识整理2">
<meta property="og:url" content="https://bone-nails.gitee.io/2021/04/01/Linux%E7%9F%A5%E8%AF%86%E6%95%B4%E7%90%862/index.html">
<meta property="og:site_name" content="Carson Zhao">
<meta property="og:description" content="Linux整理 linux多用户多任务多终端">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://imgconvert.csdnimg.cn/aHR0cHM6Ly96emotMTMwMDQwODQ5My5jb3MuYXAtY2hlbmdkdS5teXFjbG91ZC5jb20vJUU1JTlCJUJFJUU1JUJBJThBL2VuczMzLlBORw?x-oss-process=image/format,png">
<meta property="og:image" content="https://imgconvert.csdnimg.cn/aHR0cHM6Ly96emotMTMwMDQwODQ5My5jb3MuYXAtY2hlbmdkdS5teXFjbG91ZC5jb20vJUU1JTlCJUJFJUU1JUJBJThBL2xjZC5QTkc?x-oss-process=image/format,png">
<meta property="og:image" content="https://imgconvert.csdnimg.cn/aHR0cHM6Ly96emotMTMwMDQwODQ5My5jb3MuYXAtY2hlbmdkdS5teXFjbG91ZC5jb20vJUU1JTlCJUJFJUU1JUJBJThBL2Noa2NvbmZpZyUyMC0tbGlzdC5QTkc?x-oss-process=image/format,png">
<meta property="article:published_time" content="2021-04-01T04:24:20.000Z">
<meta property="article:modified_time" content="2021-04-01T04:21:04.195Z">
<meta property="article:author" content="Carson Zhao">
<meta property="article:tag" content="Linux">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://imgconvert.csdnimg.cn/aHR0cHM6Ly96emotMTMwMDQwODQ5My5jb3MuYXAtY2hlbmdkdS5teXFjbG91ZC5jb20vJUU1JTlCJUJFJUU1JUJBJThBL2VuczMzLlBORw?x-oss-process=image/format,png">


<link rel="canonical" href="https://bone-nails.gitee.io/2021/04/01/Linux%E7%9F%A5%E8%AF%86%E6%95%B4%E7%90%862/">


<script class="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : false,
    isPost : true,
    lang   : 'zh-CN'
  };
</script>
<title>Linux知识整理2 | Carson Zhao</title>
  




  <noscript>
  <style>
  body { margin-top: 2rem; }

  .use-motion .menu-item,
  .use-motion .sidebar,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header {
    visibility: visible;
  }

  .use-motion .header,
  .use-motion .site-brand-container .toggle,
  .use-motion .footer { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle,
  .use-motion .custom-logo-image {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line {
    transform: scaleX(1);
  }

  .search-pop-overlay, .sidebar-nav { display: none; }
  .sidebar-panel { display: block; }
  </style>
</noscript>

<link rel="alternate" href="/hexo_blog/atom.xml" title="Carson Zhao" type="application/atom+xml">
</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="headband"></div>

  <main class="main">
    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏" role="button">
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/hexo_blog/" class="brand" rel="start">
      <i class="logo-line"></i>
      <h1 class="site-title">Carson Zhao</h1>
      <i class="logo-line"></i>
    </a>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>



<nav class="site-nav">
  <ul class="main-menu menu">
        <li class="menu-item menu-item-home"><a href="/hexo_blog/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a></li>
        <li class="menu-item menu-item-about"><a href="/hexo_blog/about/" rel="section"><i class="fa fa-user fa-fw"></i>关于</a></li>
        <li class="menu-item menu-item-tags"><a href="/hexo_blog/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>标签</a></li>
        <li class="menu-item menu-item-categories"><a href="/hexo_blog/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类</a></li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup"><div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocapitalize="off" maxlength="80"
           placeholder="搜索..." spellcheck="false"
           type="search" class="search-input">
  </div>
  <span class="popup-btn-close" role="button">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div class="search-result-container no-result">
  <div class="search-result-icon">
    <i class="fa fa-spinner fa-pulse fa-5x"></i>
  </div>
</div>

    </div>
  </div>

</div>
        
  
  <div class="toggle sidebar-toggle" role="button">
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
  </div>

  <aside class="sidebar">

    <div class="sidebar-inner sidebar-nav-active sidebar-toc-active">
      <ul class="sidebar-nav">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <div class="sidebar-panel-container">
        <!--noindex-->
        <div class="post-toc-wrap sidebar-panel">
            <div class="post-toc animated"><ol class="nav"><li class="nav-item nav-level-3"><a class="nav-link" href="#Linux%E6%95%B4%E7%90%86"><span class="nav-number">1.</span> <span class="nav-text">Linux整理</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#linux%E5%A4%9A%E7%94%A8%E6%88%B7%E5%A4%9A%E4%BB%BB%E5%8A%A1%E5%A4%9A%E7%BB%88%E7%AB%AF"><span class="nav-number"></span> <span class="nav-text">linux多用户多任务多终端</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%9F%BA%E6%9C%AC%E5%91%BD%E4%BB%A4"><span class="nav-number"></span> <span class="nav-text">基本命令</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#linux-unix%E7%9B%AE%E5%BD%95%E7%BB%93%E6%9E%84"><span class="nav-number"></span> <span class="nav-text">linux&#x2F;unix目录结构</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E8%A7%A3%E6%9E%90%E5%99%A8%E7%9A%84%E5%86%85-%E5%A4%96%E9%83%A8%E6%8C%87%E4%BB%A4%EF%BC%9A"><span class="nav-number"></span> <span class="nav-text">解析器的内&#x2F;外部指令：</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E6%9F%A5%E7%9C%8B%E5%B8%AE%E5%8A%A9%E6%96%87%E6%A1%A3"><span class="nav-number"></span> <span class="nav-text">查看帮助文档</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E6%8C%87%E4%BB%A4%E7%9A%84%E6%9F%A5%E6%89%BE%E8%BF%87%E7%A8%8B"><span class="nav-number"></span> <span class="nav-text">指令的查找过程</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#rm-rf-%E5%88%A0%E5%BA%93"><span class="nav-number"></span> <span class="nav-text">rm -rf &#x2F;*  删库</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#linux%E5%9F%BA%E6%9C%AC%E6%8C%87%E4%BB%A4%E8%A1%A5%E5%85%85"><span class="nav-number"></span> <span class="nav-text">linux基本指令补充</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Linux%E9%85%8D%E7%BD%AE%E7%BD%91%E5%8D%A1-nmtui%E2%80%93%E4%BD%BF%E7%94%A8xshell"><span class="nav-number"></span> <span class="nav-text">Linux配置网卡#nmtui–使用xshell</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Xshell%E4%BD%BF%E7%94%A8%E6%94%BB%E7%95%A5"><span class="nav-number"></span> <span class="nav-text">Xshell使用攻略</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E8%BF%9B%E7%A8%8B%E6%9C%8D%E5%8A%A1%E7%9B%B8%E5%85%B3"><span class="nav-number"></span> <span class="nav-text">进程服务相关</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#%E6%98%BE%E7%A4%BA%E7%BD%91%E7%BB%9C%E7%8A%B6%E6%80%81%EF%BC%88%E9%9C%80%E8%A6%81%E5%AE%89%E8%A3%85net-tools%EF%BC%89"><span class="nav-number">1.</span> <span class="nav-text">显示网络状态（需要安装net-tools）</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#BIOS%E5%9F%BA%E6%9C%AC%E8%BE%93%E5%85%A5%E8%BE%93%E5%87%BA%E7%B3%BB%E7%BB%9F"><span class="nav-number"></span> <span class="nav-text">BIOS基本输入输出系统</span></a></div>
        </div>
        <!--/noindex-->

        <div class="site-overview-wrap sidebar-panel">
          <div class="site-author site-overview-item animated" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="Carson Zhao"
      src="/hexo_blog/images/1.png">
  <p class="site-author-name" itemprop="name">Carson Zhao</p>
  <div class="site-description" itemprop="description"></div>
</div>
<div class="site-state-wrap site-overview-item animated">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/hexo_blog/archives">
          <span class="site-state-item-count">59</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/hexo_blog/categories/">
          
        <span class="site-state-item-count">14</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/hexo_blog/tags/">
          
        <span class="site-state-item-count">35</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>
  <div class="cc-license site-overview-item animated" itemprop="license">
    <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh" class="cc-opacity" rel="noopener" target="_blank"><img src="/hexo_blog/images/cc-by-nc-sa.svg" alt="Creative Commons"></a>
  </div>



        </div>
      </div>
    </div>
  </aside>
  <div class="sidebar-dimmer"></div>


    </header>

    
  <div class="back-to-top" role="button">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>

<noscript>
  <div class="noscript-warning">Theme NexT works best with JavaScript enabled</div>
</noscript>


    <div class="main-inner post posts-expand">


  


<div class="post-block">
  
  

  <article itemscope itemtype="http://schema.org/Article" class="post-content" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://bone-nails.gitee.io/2021/04/01/Linux%E7%9F%A5%E8%AF%86%E6%95%B4%E7%90%862/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/hexo_blog/images/1.png">
      <meta itemprop="name" content="Carson Zhao">
      <meta itemprop="description" content="">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Carson Zhao">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          Linux知识整理2
        </h1>

        <div class="post-meta-container">
          <div class="post-meta">
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar"></i>
      </span>
      <span class="post-meta-item-text">发表于</span>
      

      <time title="创建时间：2021-04-01 12:24:20 / 修改时间：12:21:04" itemprop="dateCreated datePublished" datetime="2021-04-01T12:24:20+08:00">2021-04-01</time>
    </span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-folder"></i>
      </span>
      <span class="post-meta-item-text">分类于</span>
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/hexo_blog/categories/Linux/" itemprop="url" rel="index"><span itemprop="name">Linux</span></a>
        </span>
    </span>

  
    <span class="post-meta-item" title="阅读次数" id="busuanzi_container_page_pv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="far fa-eye"></i>
      </span>
      <span class="post-meta-item-text">阅读次数：</span>
      <span id="busuanzi_value_page_pv"></span>
    </span>
    <span class="post-meta-item" title="本文字数">
      <span class="post-meta-item-icon">
        <i class="far fa-file-word"></i>
      </span>
      <span class="post-meta-item-text">本文字数：</span>
      <span>5.4k</span>
    </span>
    <span class="post-meta-item" title="阅读时长">
      <span class="post-meta-item-icon">
        <i class="far fa-clock"></i>
      </span>
      <span class="post-meta-item-text">阅读时长 &asymp;</span>
      <span>5 分钟</span>
    </span>
</div>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">
        <h3 id="Linux整理"><a href="#Linux整理" class="headerlink" title="Linux整理"></a>Linux整理</h3><span id="more"></span>
<h2 id="linux多用户多任务多终端"><a href="#linux多用户多任务多终端" class="headerlink" title="linux多用户多任务多终端"></a>linux多用户多任务多终端</h2><p><a target="_blank" rel="noopener" href="https://zzj-1300408493.cos.ap-chengdu.myqcloud.com/%E6%96%87%E6%A1%A3%E5%92%8C%E6%95%99%E7%A8%8B/Liunx%E5%B8%B8%E7%94%A8%E5%91%BD%E4%BB%A4%20%281%29.docx">常用命令文档</a></p>
<h2 id="基本命令"><a href="#基本命令" class="headerlink" title="基本命令"></a>基本命令</h2><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br></pre></td><td class="code"><pre><span class="line">系统主机名：hostname</span><br><span class="line">登录：login</span><br><span class="line"></span><br><span class="line">#who：谁在用系统</span><br><span class="line">#logname:当前是哪个用户</span><br><span class="line">#id:</span><br><span class="line">#tty:目前在哪个终端</span><br><span class="line">alt+f*：切换到*终端</span><br><span class="line"></span><br><span class="line">#useradd B17040125 创建用户</span><br><span class="line">#passwd B17040125 为用户设置密码</span><br><span class="line"></span><br><span class="line">#less &#x2F;etc&#x2F;services:查看端口号，按q退出（随意浏览文件，不加载）</span><br><span class="line">DNS端口号53 http端口号80  ssh端口号22</span><br><span class="line">#more &#x2F;etc&#x2F;services:逐页显示内容，按空格下一页，按b返回。</span><br><span class="line">#tail &#x2F;etc&#x2F;passwd:查看文件的尾部</span><br><span class="line">#cat &#x2F;etc&#x2F;passwd：查看文件（常与&gt;和&gt;&gt;使用）</span><br><span class="line">#cat &gt; file	从键盘读取数据，创建新文件或者替换已有文件</span><br><span class="line">#cat &gt;&gt; file	从键盘读取数据，将数据追加到已有文件中</span><br><span class="line">#cat &lt; file	显示一个已有文件</span><br><span class="line">#ls：显示当前目录下的内容</span><br><span class="line">#ls -l或者#ll：详细方式显示信息</span><br><span class="line">#echo &quot;aa&quot;:echo用于输出指定的字符串。</span><br><span class="line">#ps -e查看系统的每一个进程  </span><br><span class="line"></span><br><span class="line">#cd &#x2F;回到根目录</span><br><span class="line">#cd ..&#x2F;返回上一级目录</span><br><span class="line">#pwd：显示当前路径</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">#hostname &gt; x:将主机名传给文件x（&gt;:覆盖）  </span><br><span class="line">#echo &quot;aa&quot; &gt;&gt; x :输出aa，通过管道叠加给文件x（结果：主机名+aa）</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">#tar -zcvf  a.tar.gz&#x2F;bz2  aaa  bbb  ccc :将aaa，bbb，ccc三个文件一起打包成a.tar.gz&#x2F;bz2</span><br><span class="line">#tar -zxvf  a.tar.gz&#x2F;bz2 ：将a.tar.gz&#x2F;bz2解压到当前目录</span><br><span class="line">#file a.tar.gz:显示文件的类型</span><br><span class="line"></span><br><span class="line">#mv a.tar.gz b.tar.gz:mv的作用：给文件或目录改名或者移动文件或目录。</span><br><span class="line">mv 文件名 文件名	将源文件名改为目标文件名</span><br><span class="line">mv 文件名 目录名	将文件移动到目标目录</span><br><span class="line">mv 目录名 目录名	目标目录已存在，将源目录移动到目标目录；目标目录不存在则改名</span><br><span class="line">#rm a.tar.gz：删除文件（有提示）删除文件可以直接使用rm命令，若删除目录则必须配合选项&quot;-r&quot;</span><br><span class="line">#touch abc：用于修改文件或目录的时间属性，若没有此文件，则touch作用为创建新文件。</span><br><span class="line">#cp abc cba：用于将abc复制一份并且命名为cba。</span><br><span class="line"></span><br><span class="line">查找系统目录下以.jsp为后缀，60分钟前修改的文件：#find &#x2F; -name &quot;*.jsp&quot; -mmin -60</span><br><span class="line">查找当前目录下以.jsp为后缀，3天前前修改的文件：#find . -name &quot;*.jsp&quot; -mtime -3</span><br><span class="line">查找netstat指令的绝对路径：which netstat   结果：&#x2F;user&#x2F;bin&#x2F;netstat</span><br><span class="line">查找netstat属于哪个包：rpm -qf &#x2F;bin&#x2F;netstat</span><br><span class="line"></span><br><span class="line">为文件nj创建软连接nj.link:  ln -s nj nj.link</span><br><span class="line"></span><br></pre></td></tr></table></figure>
<h2 id="linux-unix目录结构"><a href="#linux-unix目录结构" class="headerlink" title="linux/unix目录结构"></a>linux/unix目录结构</h2><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br></pre></td><td class="code"><pre><span class="line">&#x2F;bin  【可执行文件目录】</span><br><span class="line">&#x2F;sbin  【存放只有管理员能执行的指令】</span><br><span class="line">&#x2F;etc  【存放配置文件】</span><br><span class="line">      passwd：所有用户的基本信息 0：0（UID，GID）</span><br><span class="line">      shadow：存储用户的密码（加密过的）</span><br><span class="line">      sysconfig&#x2F;network-scripts&#x2F;ifcfg-ens33：网卡信息</span><br><span class="line">            BOOTPROTO：IP地址分配方式</span><br><span class="line">            UUID：唯一生成标志码（相当于主键）</span><br><span class="line">            GETWAY（所有消息的出口ip）：两种方式：</span><br><span class="line">                        网关，默认为2，配合PREFIX&#x3D;&quot;24&quot;</span><br><span class="line">                        或者直接GETWAY&#x3D;&quot;255.255.255.0&quot;</span><br><span class="line">            IPADDR：保证虚拟机和主机的IP地址在同一个网段</span><br><span class="line">            DNS：包括域名解析功能</span><br><span class="line">&#x2F;boot：【存放系统启动所需的文件】</span><br><span class="line">&#x2F;lib：【存放共享库和内核模块】</span><br><span class="line">&#x2F;mnt: 【挂载点】</span><br><span class="line">&#x2F;home：【普通用户的家】</span><br><span class="line">&#x2F;var：【第三方库】</span><br><span class="line"></span><br></pre></td></tr></table></figure>
<h2 id="解析器的内-外部指令："><a href="#解析器的内-外部指令：" class="headerlink" title="解析器的内/外部指令："></a>解析器的内/外部指令：</h2><p><code>cd</code><br><code>pwd </code><br><code>help</code><br>外部指令：（从/bin和/sbin目录中找）：ls、mkdir、cp…..</p>
<h2 id="查看帮助文档"><a href="#查看帮助文档" class="headerlink" title="查看帮助文档"></a>查看帮助文档</h2><p>内部命令：help+命令（help cd）<br>外部命令：man+命令(man ls)</p>
<h2 id="指令的查找过程"><a href="#指令的查找过程" class="headerlink" title="指令的查找过程"></a>指令的查找过程</h2><ol>
<li>在当前目录找  </li>
<li>找不到根据环境变量去/bin和/sbin目录找</li>
</ol>
<h2 id="rm-rf-删库"><a href="#rm-rf-删库" class="headerlink" title="rm -rf /*  删库"></a><code>rm -rf /*</code>  删库</h2><p>把所有的目录和文件都赋予相关的操作权限(删库的前提)<br><code>chmod -R 777 /</code>  </p>
<h2 id="linux基本指令补充"><a href="#linux基本指令补充" class="headerlink" title="linux基本指令补充"></a>linux基本指令补充</h2><ol>
<li><code>ls</code> 【显示文件和目录列表】<ol>
<li><code>-l</code> 【显示具体信息】</li>
<li><code>-a</code> 【显示所有文件】，包括隐藏文件，特殊目录.和..</li>
</ol>
</li>
<li><code>touch</code> 【创建空文本】</li>
<li><code>mkdir</code>  【创建目录】<ol>
<li><code>-p</code> ：【连续创建多级目录】（parents）</li>
</ol>
</li>
<li><code>cp</code> ：【文本复制】     <code>cp 复制路径  粘贴路径</code><br> 1.<code>-r</code> :【递归处理】，将指定目录下的文件和子目录一起拷贝   </li>
</ol>
<p>家目录创建一个a.txt同时创建一个叫做b的目录，并且进入到b<br>中，创建b1,b2,b3三个文本文件，复制a.txt到根目录下，复制b和b下的所有文件到/home目录下</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">cd root</span><br><span class="line">touch a.txt</span><br><span class="line">mkdir b</span><br><span class="line">cd b</span><br><span class="line">touch b1.txt b2.txt b3.txt</span><br><span class="line">cp ~&#x2F;a.txt &#x2F;</span><br><span class="line">cp -r ~&#x2F;b  &#x2F;home</span><br></pre></td></tr></table></figure>
<ol start="5">
<li><p><code>mv</code> 【移动文件或目录或改名】</p>
<ol>
<li>移动文件：文件的原地址和目标地址必须不同<ol>
<li>mv a.txt /home</li>
</ol>
</li>
<li>重命名文件:目标位置和源位置必须相同<ol>
<li>mv a.txt a2.txt</li>
</ol>
</li>
<li>重命名目录：目标位置和源位置必须相同<ol>
<li>mv /home/directory_1  /home/directory_2</li>
</ol>
</li>
</ol>
</li>
<li><p><code>rm</code> 【删除普通文件】</p>
<ol>
<li><code>-r</code> 【递归删除】</li>
<li><code>-f</code> 【强制删除没有提示】</li>
<li><code>rmdir</code>：【删除空目录】</li>
<li><code>rm -rf</code>【删除非空目录】</li>
</ol>
</li>
<li><p><code>cat</code> 【显示文本内容】</p>
<ol>
<li><code>-n</code> 【显示文本行号】</li>
</ol>
</li>
<li><p><code>more</code> 【可以显示文本已读百分比，向下翻页不能向上翻页】</p>
</li>
<li><p> <code>less</code> 【没有百分比显示，可以上下翻页，可以进行全文检索，底行输入/字符串，全文检索字符串。】</p>
</li>
<li><p><code>head/tail</code> 【查看文本开头或结尾的内容，默认10行】</p>
<ol>
<li><code>head -5 b.txt</code> 查看前5行</li>
<li><code>tail -F b.txt</code>循环读取，如果文本内容发生变化会同步显示更新<ol>
<li>新开一个终端，修改源文件：<code>echo aaa &gt;&gt; hello.html</code></li>
<li>可以看到原终端输出内容改变</li>
<li><code>echo aaa &gt; hello.html</code>报错：文件已截断</li>
<li>输出重定向&gt; 这个符号做的是 重写（覆盖原文件）然后写入（输出）新的内容在里面，而tail -f 这边只是读取这个文件的末尾几行，他user2里重写的话，就把之前的内容清空了，所以造成了user1报错，如果不是重写而是追加就不会报错了，所以用 输出重定向的 &gt;&gt; 这个符号（追加的符号）来进行操作，两边就都一切正常了</li>
</ol>
</li>
</ol>
</li>
<li><p><code>wc</code> </p>
<ol>
<li><code>-m </code>【统计字符数】（字符数+换行符）</li>
<li><code>-w </code>【统计字数】</li>
<li><code>-l</code> 【统计行数】</li>
</ol>
</li>
<li><p><code>find</code>：【文件查找】</p>
<ol>
<li><code>find 查找范围 -name 查找目标</code></li>
<li>查找跟目录下的txt文件：find / -name *.txt</li>
</ol>
</li>
<li><p><code>grep</code>：【文本查找】</p>
<ol>
<li> <code>grep 要查找的字符  在哪个文本中查找</code></li>
<li> <code>-n</code> 【显示行号】</li>
</ol>
</li>
<li><p><code>|</code> 管道连接符：【将连接符左边的指令结果作为连接符右边指令结果的输入】</p>
<ol>
<li> 统计a.txt前五行一共有多少个字符：<code>head -5 a.txt|wc -m</code></li>
</ol>
</li>
<li><p>重定向符号 <code>&gt; &gt;&gt;</code></p>
<ol>
<li> 【将原本应该在打印台输出的内容转到指定的文本中】</li>
<li> <code>&gt;</code>表示覆盖</li>
<li> <code>&gt;&gt;</code>表示追加到文件末尾</li>
</ol>
</li>
<li><p>查找/etc/kdump.conf文件的前15行中所有path字符并且将查找到的path字符存储在/root/a.txt文本中。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">head -15 &#x2F;etc&#x2F;kdump.conf|grep path &gt;&#x2F;root&#x2F;a.txt</span><br></pre></td></tr></table></figure></li>
<li><p>查找/etc/kdump.conf文件的前15行中所有path字符并且将查找到的path字符数存储在/root/b.txt中</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">head -15 &#x2F;etc&#x2F;kdump.conf|grep path |wc -m &gt;&#x2F;root&#x2F;b.txt</span><br></pre></td></tr></table></figure></li>
<li><p>软/硬链接</p>
<ol>
<li><code>ln -s 源文件 软连接文件</code>（相当于快捷方式，存储的是目标文件的路径信息）<ol>
<li> 用<code>ll</code>查看，带箭头的就是软连接，权限有L的是软连接</li>
<li> 也可以用<code>ls -i</code> ,硬链接的i节点和源文件的i节点是相同的</li>
</ol>
</li>
<li> <code>ln 源文件 硬链接文件</code></li>
<li> 不允许给目录创建硬链接。不可以在不同文件系统的文件间建立链接。</li>
<li> 如果删除了原文件，软连接失效，硬链接不受影响。</li>
<li> 但是如果重新创建了一个同路径的源文件，软连接重新生效，但硬链接与此文件不再有关联。  </li>
<li> 软链接相当于快捷方式、硬链接是原文件的完整拷贝，和源文件具有相同的i节点号。如果删除源文件那么软连接则失效，而硬链接还可以继续使用。</li>
</ol>
</li>
<li><p><code>top</code>显示当前系统耗费资源最多的进程。</p>
</li>
<li><p><code>ifconfig</code> :查看网卡配置</p>
</li>
<li><p><code>ping</code>：测试网络连通性</p>
</li>
<li><p>tar命令</p>
<ol>
<li>-c 建立一个压缩文件的参数指令（create）</li>
<li>-x 解开一个压缩文件的参数指令（extract）</li>
<li>-z 是否需要用 gzip 压缩</li>
<li>-j 是否需要用 bzip2 压缩</li>
<li>-v 压缩的过程中显示文件（verbose）</li>
<li>-f 使用档名，在 f 之后要立即接档名（file）</li>
<li>压缩：<code>tar -zcvf  *.tar.gz  源文件路径</code></li>
<li>解压：<code>tar -zxvf  *.tar.gz</code></li>
<li>解压到指定路径：<code>tar -zxvf a.tar.gz -C 目标路径</code></li>
</ol>
</li>
<li><p>关机/重启</p>
<ol>
<li> -r:关机后重启</li>
<li> -h：关机不重启</li>
</ol>
</li>
<li><p>帮助文档</p>
<ol>
<li> cd –help</li>
<li> man cd</li>
</ol>
</li>
</ol>
<h2 id="Linux配置网卡-nmtui–使用xshell"><a href="#Linux配置网卡-nmtui–使用xshell" class="headerlink" title="Linux配置网卡#nmtui–使用xshell"></a>Linux配置网卡#nmtui–使用xshell</h2><ul>
<li>首先确保主机ping 192.168.177.200是否通。</li>
<li>linux中有一个提供ssh协议服务的进程sshd，用户通过xshell软件访问sshd</li>
<li>登录centos7，终端输入#nmtui开始配置网络<br>Edit a connection-ens33-edit-按下图进行配置（注意按自己的地址配置）<br><img src="https://imgconvert.csdnimg.cn/aHR0cHM6Ly96emotMTMwMDQwODQ5My5jb3MuYXAtY2hlbmdkdS5teXFjbG91ZC5jb20vJUU1JTlCJUJFJUU1JUJBJThBL2VuczMzLlBORw?x-oss-process=image/format,png">  </li>
<li>Activate a connection激活ens33即可，接下来就能用xshell通过192.168.177.200访问到centos7终端。</li>
</ul>
<h2 id="Xshell使用攻略"><a href="#Xshell使用攻略" class="headerlink" title="Xshell使用攻略"></a>Xshell使用攻略</h2><ul>
<li><p>Xshell登录</p>
<blockquote>
<p>超级用户登录：ssh <a href="mailto:&#114;&#x6f;&#x6f;&#116;&#x40;&#x31;&#57;&#50;&#46;&#x31;&#54;&#56;&#x2e;&#x31;&#x37;&#x37;&#46;&#50;&#48;&#48;">&#114;&#x6f;&#x6f;&#116;&#x40;&#x31;&#57;&#50;&#46;&#x31;&#54;&#56;&#x2e;&#x31;&#x37;&#x37;&#46;&#50;&#48;&#48;</a><br>普通用户登录：ssh 用户名@192.168.177.200</p>
</blockquote>
</li>
<li><p>利用sftp上传/下载文件：put/get指令（假设我们要将d盘工具库中的tomcat7这个文件上传到服务器的jspre文件夹中）</p>
<blockquote>
<p>第一步：输入sftp <a href="mailto:&#114;&#111;&#x6f;&#x74;&#64;&#49;&#x39;&#x32;&#46;&#49;&#54;&#x38;&#46;&#49;&#55;&#x37;&#x2e;&#50;&#48;&#48;">&#114;&#111;&#x6f;&#x74;&#64;&#49;&#x39;&#x32;&#46;&#49;&#54;&#x38;&#46;&#49;&#55;&#x37;&#x2e;&#50;&#48;&#48;</a>使用sftp  </p>
</blockquote>
</li>
</ul>
<blockquote>
<p>第二步：了解以下指令：<br>远端路径：cd、ls、pwd<br>本地路径：lcd、lls、lpwd</p>
</blockquote>
<blockquote>
<p>第三步：<br>进入服务器jspre文件：cd /jspre<br>进入本机工具库目录：lcd + 回车选择本地路径<br>Local directory is D:\工具库<br><img src="https://imgconvert.csdnimg.cn/aHR0cHM6Ly96emotMTMwMDQwODQ5My5jb3MuYXAtY2hlbmdkdS5teXFjbG91ZC5jb20vJUU1JTlCJUJFJUU1JUJBJThBL2xjZC5QTkc?x-oss-process=image/format,png">  </p>
</blockquote>
<blockquote>
<p>第四步：<br>put tomcat7  </p>
</blockquote>
<blockquote>
<p>注意切记：使用sftp之前不要用ssh <a href="mailto:&#114;&#111;&#111;&#x74;&#64;&#49;&#x39;&#x32;&#46;&#49;&#x36;&#56;&#46;&#49;&#55;&#x37;&#x2e;&#x32;&#x30;&#48;">&#114;&#111;&#111;&#x74;&#64;&#49;&#x39;&#x32;&#46;&#49;&#x36;&#56;&#46;&#49;&#55;&#x37;&#x2e;&#x32;&#x30;&#48;</a>登录，否则无法上传本地文件。<br>正确使用方法：直接使用sftp指令登录，或者先退出ssh再用sftp登录。</p>
</blockquote>
<h2 id="进程服务相关"><a href="#进程服务相关" class="headerlink" title="进程服务相关"></a>进程服务相关</h2><ul>
<li>查看linux开机启动项：<code>chkconfig -list</code><br><img src="https://imgconvert.csdnimg.cn/aHR0cHM6Ly96emotMTMwMDQwODQ5My5jb3MuYXAtY2hlbmdkdS5teXFjbG91ZC5jb20vJUU1JTlCJUJFJUU1JUJBJThBL2Noa2NvbmZpZyUyMC0tbGlzdC5QTkc?x-oss-process=image/format,png"><br>1单用户模式 2：无网络连接的多用户命令行模式 3：有网络连接的多用户命令行模式 4：不可用 5：带图形界面的多用户模式 6：重新启动</li>
<li>列出所有服务：<code>systemctl list-unit-files | less</code></li>
<li>搜索与java相关的进程：<code>ps -ef|grep “java”</code><h3 id="显示网络状态（需要安装net-tools）"><a href="#显示网络状态（需要安装net-tools）" class="headerlink" title="显示网络状态（需要安装net-tools）"></a>显示网络状态（需要安装net-tools）</h3></li>
<li>显示8080号端口：<code>netstat -ano|grep &quot;:8080&quot;</code></li>
<li>显示sshd进程：<code>netstat -anp|grep &quot;sshd&quot;</code><h2 id="BIOS基本输入输出系统"><a href="#BIOS基本输入输出系统" class="headerlink" title="BIOS基本输入输出系统"></a>BIOS基本输入输出系统</h2>打开电源，bios启动检查设备-到外存找操作系统-启动操作系统-启动服务。<br>Init所有进程的起点<br>后台（守护进程daemon）<br>去哪里找服务</li>
</ul>
<ol>
<li>/etc/init.d</li>
<li>/etc/rc3.d/….S开头</li>
</ol>

    </div>

    
    
    

    <footer class="post-footer">
          

<div class="post-copyright">
<ul>
  <li class="post-copyright-author">
      <strong>本文作者： </strong>Carson Zhao
  </li>
  <li class="post-copyright-link">
      <strong>本文链接：</strong>
      <a href="https://bone-nails.gitee.io/2021/04/01/Linux%E7%9F%A5%E8%AF%86%E6%95%B4%E7%90%862/" title="Linux知识整理2">https://bone-nails.gitee.io/2021/04/01/Linux知识整理2/</a>
  </li>
  <li class="post-copyright-license">
    <strong>版权声明： </strong>本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh" rel="noopener" target="_blank"><i class="fab fa-fw fa-creative-commons"></i>BY-NC-SA</a> 许可协议。转载请注明出处！
  </li>
</ul>
</div>

          <div class="post-tags">
              <a href="/hexo_blog/tags/Linux/" rel="tag"># Linux</a>
          </div>

        

          <div class="post-nav">
            <div class="post-nav-item">
                <a href="/hexo_blog/2021/04/01/%E6%95%B0%E6%8D%AE%E5%BA%93%E6%BC%94%E7%BB%83oracle11g/" rel="prev" title="数据库演练oracle11g">
                  <i class="fa fa-chevron-left"></i> 数据库演练oracle11g
                </a>
            </div>
            <div class="post-nav-item">
                <a href="/hexo_blog/2021/04/12/mysql%E7%9A%84%E6%A0%B8%E5%BF%83%E7%9F%A5%E8%AF%86%E4%B9%8B%E4%BA%8B%E5%8A%A1%E5%AE%9E%E6%88%98/" rel="next" title="mysql的核心知识之事务实战">
                  mysql的核心知识之事务实战 <i class="fa fa-chevron-right"></i>
                </a>
            </div>
          </div>
    </footer>
  </article>
</div>







<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      const activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      const commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>
</div>
  </main>

  <footer class="footer">
    <div class="footer-inner">


<div class="copyright">
  &copy; 
  <span itemprop="copyrightYear">2021</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Carson Zhao</span>
</div>
<div class="wordcount">
  <span class="post-meta-item">
    <span class="post-meta-item-icon">
      <i class="fa fa-chart-line"></i>
    </span>
      <span>站点总字数：</span>
    <span title="站点总字数">125k</span>
  </span>
  <span class="post-meta-item">
    <span class="post-meta-item-icon">
      <i class="fa fa-coffee"></i>
    </span>
      <span>站点阅读时长 &asymp;</span>
    <span title="站点阅读时长">1:54</span>
  </span>
</div>
<div class="busuanzi-count">
    <span class="post-meta-item" id="busuanzi_container_site_uv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-user"></i>
      </span>
      <span class="site-uv" title="总访客量">
        <span id="busuanzi_value_site_uv"></span>
      </span>
    </span>
    <span class="post-meta-item" id="busuanzi_container_site_pv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-eye"></i>
      </span>
      <span class="site-pv" title="总访问量">
        <span id="busuanzi_value_site_pv"></span>
      </span>
    </span>
</div>
  <div class="powered-by">由 <a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> & <a href="https://theme-next.js.org/" class="theme-link" rel="noopener" target="_blank">NexT.Gemini</a> 强力驱动
  </div>

    </div>
  </footer>

  
  <script size="300" alpha="0.6" zIndex="-1" src="https://cdn.jsdelivr.net/npm/ribbon.js@1.0.2/dist/ribbon.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/animejs@3.2.1/lib/anime.min.js"></script>
<script src="/hexo_blog/js/utils.js"></script><script src="/hexo_blog/js/next-boot.js"></script>

  
<script src="/hexo_blog/js/local-search.js"></script>



<script>
if (document.querySelectorAll('.pdf-container').length) {
  NexT.utils.getScript('https://cdn.jsdelivr.net/npm/pdfobject@2.2.4/pdfobject.min.js', () => {
    document.querySelectorAll('.pdf-container').forEach(element => {
      PDFObject.embed(element.dataset.target, element, {
        pdfOpenParams: {
          navpanes : 0,
          toolbar  : 0,
          statusbar: 0,
          pagemode : 'thumbs',
          view     : 'FitH'
        },
        PDFJS_URL: '/hexo_blog/lib/pdf/web/viewer.html',
        height   : element.dataset.height
      });
    });
  }, window.PDFObject);
}
</script>


  <script>
    NProgress.configure({
      showSpinner: true
    });
    NProgress.start();
    document.addEventListener('readystatechange', () => {
      if (document.readyState === 'interactive') {
        NProgress.inc(0.8);
      }
      if (document.readyState === 'complete') {
        NProgress.done();
      }
    });
    document.addEventListener('pjax:send', () => {
      NProgress.start();
    });
    document.addEventListener('pjax:success', () => {
      NProgress.done();
    });
  </script>

  
  <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>





<script src="/hexo_blog/live2dw/lib/L2Dwidget.min.js?094cbace49a39548bed64abff5988b05"></script><script>L2Dwidget.init({"pluginModelPath":"assets/","model":{"jsonPath":"/hexo_blog/live2dw/assets/hijiki.model.json"},"display":{"position":"right","width":200,"height":400},"mobile":{"show":true},"log":false,"pluginJsPath":"lib/","pluginRootPath":"live2dw/","tagMode":false});</script></body>
</html>
